/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.lzyzsd.circleprogress.utils.properties.model;

import com.github.lzyzsd.circleprogress.Utils;
import com.github.lzyzsd.circleprogress.utils.properties.DountProgressResPropertyHolder;
import com.github.lzyzsd.circleprogress.utils.properties.IInterface.CommonPropertyModel;
import ohos.agp.utils.Color;
import ohos.app.Context;

public class DountProgressModel extends CommonPropertyModel {
    private Color finishedStrokeColor = new Color(Color.rgb(66,145,241));;
    private Color unfinishedStrokeColor=new Color(Color.rgb(204,204,204));
    private boolean showText = true;
    private int attributeResourceId = 0;
    private int finishedStrokeWidth = 2;
    private int unfinishedStrokeWidth = 2;
    private Color textColor=new Color(Color.rgb(66,145,241));
    private int textSize = 0;
    private int innerBottomTextSize = 30;
    private Color innerBottomTextColor=new Color(Color.rgb(66,145,241));
    private String innerBottomText = "";
    private int startingDegree = 0;
    private Color innerBackgroundColor = new Color(Color.TRANSPARENT.getValue());
    private String prefixText = "";
    private String suffixText = "%";
    private String text = "";
    private int progress = 0;
    private int max = 100;

    public DountProgressModel(Context context) {
        textSize = Utils.dp2px(context.getResourceManager(), 18);
        finishedStrokeWidth = Utils.dp2px(context.getResourceManager(),10);
        unfinishedStrokeWidth = Utils.dp2px(context.getResourceManager(), 10);
        innerBottomTextSize = Utils.dp2px(context.getResourceManager() ,18);
    }

    public Color getFinishedStrokeColor() {
        return finishedStrokeColor;
    }

    public Color getUnfinishedStrokeColor() {
        return unfinishedStrokeColor;
    }

    public boolean isShowText() {
        return showText;
    }

    public int getAttributeResourceId() {
        return attributeResourceId;
    }

    public int getFinishedStrokeWidth() {
        return finishedStrokeWidth;
    }

    public int getUnfinishedStrokeWidth() {
        return unfinishedStrokeWidth;
    }

    public Color getTextColor() {
        return textColor;
    }

    public int getTextSize() {
        return textSize;
    }

    public int getInnerBottomTextSize() {
        return innerBottomTextSize;
    }

    public Color getInnerBottomTextColor() {
        return innerBottomTextColor;
    }

    public String getInnerBottomText() {
        return innerBottomText;
    }

    public int getStartingDegree() {
        return startingDegree;
    }

    public Color getInnerBackgroundColor() {
        return innerBackgroundColor;
    }

    public String getPrefixText() {
        return prefixText;
    }

    public String getSuffixText() {
        return suffixText;
    }

    public String getText() {
        return text;
    }

    public int getProgress() {
        return progress;
    }

    public int getMax() {
        return max;
    }

    public void setFinishedStrokeColor(Color finishedStrokeColor) {
        this.finishedStrokeColor = finishedStrokeColor;
    }

    public void setUnfinishedStrokeColor(Color unfinishedStrokeColor) {
        this.unfinishedStrokeColor = unfinishedStrokeColor;
    }

    public void setShowText(boolean showText) {
        this.showText = showText;
    }

    public void setAttributeResourceId(int attributeResourceId) {
        this.attributeResourceId = attributeResourceId;
    }

    public void setFinishedStrokeWidth(int finishedStrokeWidth) {
        this.finishedStrokeWidth = finishedStrokeWidth;
    }

    public void setUnfinishedStrokeWidth(int unfinishedStrokeWidth) {
        this.unfinishedStrokeWidth = unfinishedStrokeWidth;
    }

    public void setTextColor(Color textColor) {
        this.textColor = textColor;
    }

    public void setTextSize(int textSize) {
        this.textSize = textSize;
    }

    public void setInnerBottomTextSize(int innerBottomTextSize) {
        this.innerBottomTextSize = innerBottomTextSize;
    }

    public void setInnerBottomTextColor(Color innerBottomTextColor) {
        this.innerBottomTextColor = innerBottomTextColor;
    }

    public void setInnerBottomText(String innerBottomText) {
        this.innerBottomText = innerBottomText;
    }

    public void setStartingDegree(int startingDegree) {
        this.startingDegree = startingDegree;
    }

    public void setInnerBackgroundColor(Color innerBackgroundColor) {
        this.innerBackgroundColor = innerBackgroundColor;
    }

    public void setPrefixText(String prefixText) {
        this.prefixText = prefixText;
    }

    public void setSuffixText(String suffixText) {
        this.suffixText = suffixText;
    }

    public void setText(String text) {
        this.text = text;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }

    public void setMax(int max) {
        this.max = max;
    }

    public static class Builder {
        private DountProgressModel model;

        public Builder(Context context) {
            model = new DountProgressResPropertyHolder(context,null).obtainProperty();
        }

        public Builder setFinishedStrokeColor(Color finishedStrokeColor) {
            model.finishedStrokeColor = finishedStrokeColor;
            return this;
        }

        public Builder setUnfinishedStrokeColor(Color unfinishedStrokeColor) {
            model.unfinishedStrokeColor = unfinishedStrokeColor;
            return this;
        }

        public Builder setShowText(boolean showText) {
            model.showText = showText;
            return this;
        }

        public Builder setAttributeResourceId(int attributeResourceId) {
            model.attributeResourceId = attributeResourceId;
            return this;
        }

        public Builder setFinishedStrokeWidth(int finishedStrokeWidth) {
            model.finishedStrokeWidth = finishedStrokeWidth;
            return this;
        }

        public Builder setUnfinishedStrokeWidth(int unfinishedStrokeWidth) {
            model.unfinishedStrokeWidth = unfinishedStrokeWidth;
            return this;
        }

        public Builder setTextColor(Color textColor) {
            model.textColor = textColor;
            return this;
        }

        public Builder setTextSize(int textSize) {
            model.textSize = textSize;
            return this;
        }

        public Builder setInnerBottomTextSize(int innerBottomTextSize) {
            model.innerBottomTextSize = innerBottomTextSize;
            return this;
        }

        public Builder setInnerBottomTextColor(Color innerBottomTextColor) {
            model.innerBottomTextColor = innerBottomTextColor;
            return this;
        }

        public Builder setInnerBottomText(String innerBottomText) {
            model.innerBottomText = innerBottomText;
            return this;
        }

        public Builder setStartingDegree(int startingDegree) {
            model.startingDegree = startingDegree;
            return this;
        }

        public Builder setInnerBackgroundColor(Color innerBackgroundColor) {
            model.innerBackgroundColor = innerBackgroundColor;
            return this;
        }

        public Builder setPrefixText(String prefixText) {
            model.prefixText = prefixText;
            return this;
        }

        public Builder setSuffixText(String suffixText) {
            model.suffixText = suffixText;
            return this;
        }

        public Builder setText(String text) {
            model.text = text;
            return this;
        }

        public Builder setProgress(int progress) {
            model.progress = progress;
            return this;
        }

        public Builder setMax(int max) {
            model.max = max;
            return this;
        }

        public DountProgressModel build() {
            return model;
        }
    }
}
